package com.zxw.controller;

import com.aaa.entity.GSort;
import com.aaa.vo.Result;
import com.zxw.service.GSortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：zxw
 * @date ：Created in 2023/2/28 17:40
 */
@RestController
@RequestMapping("/goods/sort")
@SuppressWarnings("all")
public class GSortController {
    @Autowired
    private GSortService gSortService;

    //分页加模糊查询所有类型
    @RequestMapping("/findAllSorts")
    public Result findAllSorts(@RequestBody GSort gSort,
                              @RequestParam(defaultValue = "1") Integer pageCurrent,
                              @RequestParam(defaultValue = "5") Integer pageSize){
        Result allSort = gSortService.findAllSorts(gSort,pageCurrent,pageSize);
        return allSort;
    }

    //类型审核
    @RequestMapping("/update")
    public Result update(@RequestBody GSort gSort){
        return gSortService.updateSort(gSort);
    }

    //删除类型
    @RequestMapping("/delete")
    public Result delete(Integer id){
        return gSortService.deleteSort(id);
    }
}
